home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / jmod311.zip / JMODEM_A.C < prev    next >
Text File  |  1992-02-02  |  40KB  |  610 lines

  1. /****************************************************************************/
  2. /*    FILE JMODEM_A.C                                                       */
  3. /*                                                                          */
  4. /*    The JMODEM protocol            MicroSoft (r)  'C' V6.00               */
  5. /*    Created 03-FEB-1990            Richard B. Johnson                     */
  6. /*                                   405 Broughton Drive                    */
  7. /*                                   Beverly, Massachusetts 01915           */
  8. /*                                   BBS (508) 922-3166                     */
  9. /*                                                                          */
  10. /*    An external protocol for high-speed data transmission.                */
  11. /*                                                                          */
  12. /*    This is the MAIN module                                               */
  13. /*    The required modules are:                                             */
  14. /*    JMODEM.H    (function prototypes and structures)                      */
  15. /*    UART.H      (8250 UART parameters)                                    */
  16. /*    SCREEN.H    (function protypes and structures for the screen)         */
  17. /*    JMODEM_A.C   (this module)                                            */
  18. /*    JMODEM_B.C   (memory allocation and input parsing)                    */
  19. /*    JMODEM_C.C   (all file I/O)                                           */
  20. /*    JMODEM_D.C   (encode/decode and CRC routines)                         */
  21. /*    JMODEM_E.C   (communications I/O routines)                            */
  22. /*    JMODEM_F.C   (the screen I/O routines)                                */
  23. /*    JMODEM_G.ASM (Interrupt service routines after V3.10)                 */
  24. /*    JMODEM.      (The MAKE file )                                         */
  25. /*                                                                          */
  26. /*    This program requires about 67k of free RAM to execute properly.      */
  27. /*    If you have 66k or less, it will execute, but the screens will        */
  28. /*    not be written or replaced properly. If you have only 64k, the        */
  29. /*    program will exit with an error message.                              */
  30. /*                                                                          */
  31. /*    Revision History:                                                     */
  32. /*    V3.00   Beta test                  11-FEB-1990   Richard B. Johnson   */
  33. /*    V3.01   First release              18-FEB-1990   Richard B. Johnson   */
  34. /*    V3.02   Revised                    19-FEB-1990   Richard B. Johnson   */
  35. /*                                                                          */
  36. /*      (1)   A bug in MicroSoft _calloc()  allocates overlapping           */
  37. /*            buffers so data files were getting corrupted. I had           */
  38. /*            used both _calloc() and _malloc() at the same time and        */
  39. /*            they didn't like it. I changed the memory allocation          */
  40. /*            to _malloc() only and it seems to work okay.                  */
  41. /*                                                                          */
  42. /*      (2)   While debugging, I found some structures I didn't need and    */
  43. /*            removed them. Changed some code to accommodate.               */
  44. /*                                                                          */
  45. /*      (3)   Added a file-size during downloads.                           */
  46. /*                                                                          */
  47. /*      (4)   Changed code in the data encoding (compression) routine       */
  48. /*            in an attempt to speed it up.                                 */
  49. /*                                                                          */
  50. /*    V3.03   Revised                   20-FEB-1990  Richard B. Johnson     */
  51. /*                                                                          */
  52. /*      (5)   Fixed bug in compression routine where the loop wasn't        */
  53. /*            terminating properly, adding random characters. Bug was       */
  54. /*            created during V3.02 change.                                  */
  55. /*                                                                          */
  56. /*    V3.04   Revised                   27-FEB-1990  Richard B. Johnson     */
  57. /*                                                                          */
  58. /*      (1)   Modified the block-size routine and the receive-block         */
  59. /*            routine in an attempt to improve the noise immunity.          */
  60. /*            Does not abort even if you whistle into the telephone         */
  61. /*            during uploads and downloads. Waits 5 seconds to clear        */
  62. /*            the interrupt buffer when a bad block-size is received.       */
  63. /*                                                                          */
  64. /*      (2)   Added a 1/2 second wait for modem status when opening         */
  65. /*            channel. This might accommodate slow modems response to       */
  66. /*            RTS.                                                          */
  67. /*                                                                          */
  68. /*    V3.05   Revised                   22-MAR-1990  Richard B. Johnson     */
  69. /*                                                                          */
  70. /*      (1)   Removed _sprintf() runtime library calls to shorten           */
  71. /*            the code. Saved about 4k.                                     */
  72. /*                                                                          */
  73. /*      (2)   Removed extra spaces in the signon-logo to shorten            */
  74. /*            the program size.                                             */
  75. /*                                                                          */
  76. /*      (3)   Changed the method of creating a fixed-length string          */
  77. /*            for both the block size and cps numbers which saved about     */
  78. /*            800 bytes of program size.                                    */
  79. /*                                                                          */
  80. /*      (4)   Changed numerous array indexes in JMODEM_F.C to pointers      */
  81. /*            to reduce code size. Saved a few hundred bytes and should     */
  82. /*            improve speed of screen output.                               */
  83. /*                                                                          */
  84. /*      (5)   Created a local _puts() routine which saved over 6k from the  */
  85. /*            MicroSoft C runtime library version. (JMODEM_F.C)             */
  86. /*                                                                          */
  87. /*    V3.06   Revised                   07-APR-1990  Richard B. Johnson     */
  88. /*                                                                          */
  89. /*      (1)   Put the filename text into the syst structure as a pointer    */
  90. /*            to char. This allowed me to save 56 bytes of code and now     */
  91. /*            only two parameters are passed to the _screen() function.     */
  92. /*                                                                          */
  93. /*      (2)   Modified the syst structure and supporting code.              */
  94. /*                                                                          */
  95. /*      (3)   Moved all external data and functions to the JMODEM.H file.   */
  96. /*                                                                          */
  97. /*      (4)   Moved _disp() "usage" module to JMODEM_F.C                    */
  98. /*                                                                          */
  99. /*      (5)   Changed arrays in JMODEM_B.C to pointers to reduce code-      */
  100. /*            size. Eliminated _strcpy() from the command-line parsing      */
  101. /*            routines. Brought the code-size to less than 12,000 bytes.    */
  102. /*                                                                          */
  103. /*      (6)   Reduced the code-s